﻿using EkStudio.com.bean.xml.BillModule;
using EkStudio.com.bean.xml.reflection;
using EkStudio.com.bean.xml.RootInterface;
using EkStudio.com.bean.xml.Unit;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EkStudio.com.bean.xml.BillDictionary
{
    public class BillDicModuleRoot: BillObjectInterface
    {
        private string caption = "";
        private string key = "";
        private string languageTexts = "";
        private string rootVersion = BeanUtil.VERSION;

        private BillModuleOwner ownerProperties = null;

        private BillDicModuleItem parent = null;

        [Xml]
        public string Caption
        {
            get { return caption; }
            set { caption = value; }
        }
        [Xml]
        public string Key
        {
            get { return key; }
            set { key = value; }
        }
        [Xml]
        public string LanguageTexts
        {
            get { return languageTexts; }
            set { languageTexts = value; }
        }
        [Xml]
        public string RootVersion
        {
            get { return rootVersion; }
            set { rootVersion = value; }
        }
        [XmlElement]
        public BillModuleOwner OwnerProperties
        {
            get { return ownerProperties; }
            set { ownerProperties = value; }
        }

        [XmlTransient]
        public object ParentBean
        {
            get
            {
                return parent;
            }

            set
            {
                if(value is BillDicModuleItem) parent = (BillDicModuleItem)value;   
            }
        }

        public object Clone()
        {
            BillDicModuleRoot clone = new BillDicModuleRoot();
            clone.Key = Key;
            clone.Caption = Caption;
            clone.LanguageTexts = "";
            clone.OwnerProperties = (BillModuleOwner)ownerProperties.Clone();
            clone.ParentBean = null;
            return clone;
        }
    }
}
